﻿<Window x:Class="VisualRibbonEditor.MainWindow"
		xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		Title="Visual Ribbon Editor for CRM 2011-2016" Height="650" Width="850" xmlns:my="clr-namespace:VisualRibbonEditor" Loaded="Window_Loaded" >

	<Grid x:Name="LayoutRoot" Background="White" >
		<Grid.LayoutTransform>
			<!--Scale the application so it looks OK in WPF-->
			<ScaleTransform CenterX="0" CenterY="0"  ScaleX="0.85" ScaleY="0.85" />
		</Grid.LayoutTransform>

		<Grid.RowDefinitions>
			<RowDefinition Height="30" />
			<RowDefinition Height="155" />
			<RowDefinition Height="45" />
			<RowDefinition Height="*" />
			<RowDefinition Height="25" />
		</Grid.RowDefinitions>


		<Border Margin="0" BorderBrush="#888888" BorderThickness="0,0,0,1" Padding="0,3,0,3" Background="#eeeeee"  >

			<StackPanel Name="ToolBarStack" Orientation="Horizontal">
				<Button Margin="8,0,2,0" Width="27"  Name="ConnectionButton" Click="ConnectionButton_Click" ToolTip="Connection Info..." >
					<Image Source="/VisualRibbonEditor;component/Assets/connect.png" Height="18" Width="18" />
				</Button>

				<Button Margin="2,0,2,0" Name="OpenButton" Click="OpenButton_Click" ToolTip="Open Ribbon...">
					<StackPanel Orientation="Horizontal">
						<Image Source="/VisualRibbonEditor;component/Assets/open.png" Height="18" Width="18" />
						<TextBlock Text="Open" Margin="3,0,3,0" />
					</StackPanel>
				</Button>
				<Button Margin="2,0,4,0" Click="SaveCurrentRibbon" Name="SaveButton" ToolTip="Save Ribbon..."   >
					<StackPanel Orientation="Horizontal">
						<Image Source="/VisualRibbonEditor;component/Assets/save.png" Height="18" Width="18" />
						<TextBlock Text="Save" Margin="3,0,3,0" />
					</StackPanel>
				</Button>

				<TextBlock Text="Ribbon Type: " VerticalAlignment="Center" Margin="8,0,0,0" Foreground="#222222" />
				<ComboBox Name="RibbonType"  SelectionChanged="RibbonType_SelectionChanged" Width="105" Height="21" VerticalAlignment="Center" Margin="2,0,2,0" />
				<Button Name="NewButton"   ToolTipService.ToolTip="Insert a new button into the ribbon" Click="NewButton_Click" Margin="2,0,2,0">
					<StackPanel Orientation="Horizontal">
						<Image Source="/VisualRibbonEditor;component/Assets/button.png" Height="16" Width="16" Margin="2 0 0 0"/>
						<TextBlock Text="New Button" Margin="2,0,2,0" />
					</StackPanel>
				</Button>
				<Button Name="NewGroup" ToolTipService.ToolTip="Insert a new group into the ribbon" Click="NewGroup_Click" Margin="2,0,2,0">
					<StackPanel Orientation="Horizontal">
						<Image Source="/VisualRibbonEditor;component/Assets/group.png" Height="16" Width="16" Margin="2 0 0 0" />
						<TextBlock Text="New Group" Margin="2,0,2,0" />
					</StackPanel>
				</Button>
				<!-- Compact "New" Button
				<Button Name="NewMenuButton" IsEnabledChanged="NewMenuButton_IsEnabledChanged" ContextMenuService.IsEnabled="False" ToolTipService.ToolTip="Insert a new element into the ribbon" Click="NewMenuButton_Click" Margin="4,0,4,0">
					<StackPanel Orientation="Horizontal">
						<TextBlock Name="NewMenuButton_TextBlock"  Text="New..." Margin="3,0,3,0" />
						<Path x:Name="NewMenuButton_ArrowDown" Margin="4" VerticalAlignment="Center" Width="6" Fill="Black" Stretch="Uniform" HorizontalAlignment="Right" Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z "/>
					</StackPanel>
					<Button.ContextMenu>
						<ContextMenu Name="NewMenu">
							<ContextMenu.Items>
								<MenuItem Name="NewButton" ToolTipService.ToolTip="Insert a new button into the ribbon" Click="NewButton_Click">
									<MenuItem.Icon><Image Source="/VisualRibbonEditor;component/Assets/button.png" Width="16" Height="16" /></MenuItem.Icon>
									<MenuItem.Header><TextBlock Text="Button" /></MenuItem.Header>
								</MenuItem>
								<MenuItem Name="NewGroup" ToolTipService.ToolTip="Insert a new group into the ribbon" Click="NewGroup_Click">
									<MenuItem.Icon>
										<Image Source="/VisualRibbonEditor;component/Assets/group.png" Width="16" Height="16" />
									</MenuItem.Icon>
									<MenuItem.Header><TextBlock Text="Group" /></MenuItem.Header>
								</MenuItem>
							</ContextMenu.Items>
						</ContextMenu>
					</Button.ContextMenu>
				</Button>
				-->
				<Button Name="DeleteButton" ToolTipService.ToolTip="Delete the selected button" Click="DeleteButton_Click" Margin="2 0 2 0">
					<StackPanel Orientation="Horizontal">
						<Image Source="/VisualRibbonEditor;component/Assets/delete.png" Height="16" Width="16" />
					</StackPanel>
				</Button>

				<TextBlock Text="|" Margin="2,2,2,2" Foreground="Gray" />
				<Button Name="HideButton" Content=" Hide Button "  ToolTipService.ToolTip="Click to make the currrent button hidden" Click="HideButton_Click" Margin="3,0,0,0" />
				<Button Name="HideTab" Content=" Hide Tab "  ToolTipService.ToolTip="Click to hide current tab" Click="HideTab_Click" Margin="3,0,0,0" />
				<Button Name="UnHideDialogButton" Content=" Un-Hide "  ToolTipService.ToolTip="Click to un-hide controls" Margin="3,0,0,0" Click="UnHideDialogButton_Click" />
			</StackPanel>
		</Border>

		<StackPanel Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Right">
			<Button Content=" View Web Resources " IsEnabled="False" Name="ViewWebResourcesButton" Click="ViewWebResourcesButton_Click"  Margin="0,3,4,4" ToolTip="View Web Resources" />
			<Button Content=" View XML " Name="ViewXmlButton" Click="ViewXmlButton_Click"  Margin="0,3,4,4" ToolTip="View RibbonDiffXml" />
		</StackPanel>
		<StackPanel Grid.Row="1">
			<Border Margin="0,5,0,0" BorderThickness="0,0,0,1" BorderBrush="#ffb6babf" Padding="5,0,0,0">
				<StackPanel Orientation="Horizontal" Name="TabStack" Height="21" >
				</StackPanel>
			</Border>

			<ScrollViewer Height="120" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Hidden" BorderThickness="0" Padding="0" >
				<Border BorderThickness="0,0,0,1" BorderBrush="#ff898d92" >
					<Border.Background>
						<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
							<GradientStop Color="White" Offset="0" />
							<GradientStop Color="#fcfcfc" Offset="0.6" />
							<GradientStop Color="#e8ebef" Offset="1" />
						</LinearGradientBrush>
					</Border.Background>

					<StackPanel Orientation="Horizontal" Name="RibbonStack"></StackPanel>
				</Border>
			</ScrollViewer>
		</StackPanel>

		<TextBlock Name="SelectedButtonIdText" Grid.Row="2" Grid.Column="1" Foreground="Gray"
				   Margin="5,0" FontSize="15" FontWeight="Bold" FontStyle="Italic"   />
		<Border BorderThickness="0,0,0,1" Margin="5,0,5,0" Grid.Row="2" Grid.Column="1" Name="EditorTabStackBorder" BorderBrush="#ffb6babf" Height="21" VerticalAlignment="Bottom">
			<StackPanel Orientation="Horizontal" Name="EditorTabStack">
				<my:Tab DisplayName=" Details " x:Name="DetailTab" Margin="5,0,5,0" Click="DetailTab_Click"  >
					<my:Tab.RenderTransform>
						<TranslateTransform Y="1" />
					</my:Tab.RenderTransform>
				</my:Tab>
				<my:Tab DisplayName=" Action " x:Name="ActionTab" Margin="0,0,5,0" Click="ActionTab_Click" >
					<my:Tab.RenderTransform>
						<TranslateTransform Y="1" />
					</my:Tab.RenderTransform>
				</my:Tab>
				<my:Tab DisplayName=" Display Rules " x:Name="DisplayRulesTab" Margin="0,0,5,0" Click="DisplayRulesTab_Click" >
					<my:Tab.RenderTransform>
						<TranslateTransform Y="1" />
					</my:Tab.RenderTransform>
				</my:Tab>
				<my:Tab DisplayName=" Enable Rules " x:Name="EnableRulesTab" Margin="0,0,5,0" Click="EnableRulesTab_Click" >
					<my:Tab.RenderTransform>
						<TranslateTransform Y="1" />
					</my:Tab.RenderTransform>
				</my:Tab>
			</StackPanel>
		</Border>

		<Border Grid.Row="3"   BorderThickness="1,0,1,1" Name="XmlDetailStackBorder"   BorderBrush="#ffb6babf" Margin="5,0,5,5" Padding="5">
			<StackPanel Name="XmlDetailStack">

			</StackPanel>
		</Border>


		<Border Name="InProgressBorder" Grid.RowSpan="5" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch"
				 Background="#33000000" Visibility="Collapsed"   >
			<Border Grid.RowSpan="5" HorizontalAlignment="Center" Width="300" VerticalAlignment="Center"
				CornerRadius="15" MinHeight="80" BorderThickness="1.5" BorderBrush="Black" Background="White" >
				<StackPanel Margin="5" VerticalAlignment="Center">
					<TextBlock Name="InProgressText" Text="Loading Ribbon..."  TextWrapping="Wrap"
						VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="17" Foreground="Blue" />
					<TextBlock Name="InProgressSubText" Visibility="Collapsed" HorizontalAlignment="Center" Margin="3" Foreground="Gray" />
				</StackPanel>
			</Border>
		</Border>


		<Border Name="DialogBorder" Grid.RowSpan="5" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch"
				 Background="#33000000" Visibility="Collapsed" >
		</Border>
		<Border Grid.Row="4" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch"
				 BorderThickness="1,1,1,1" Name="StatusBarBorder" BorderBrush="#ffb6babf" Background="#eeeeee">

			<StatusBar Height="21" Margin="0,0,0,0" Name="StatusBar" Background="#eeeeee" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
				<StatusBar.ItemsPanel>
					<ItemsPanelTemplate>
						<Grid>
							<Grid.RowDefinitions>
								<RowDefinition Height="21"/>
							</Grid.RowDefinitions>
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="550"/>
								<ColumnDefinition Width="5"/>
								<ColumnDefinition Width="Auto" MinWidth="100"/>
								<ColumnDefinition Width="5"/>
								<ColumnDefinition Width="*"/>
							</Grid.ColumnDefinitions>
						</Grid>
					</ItemsPanelTemplate>
				</StatusBar.ItemsPanel>
				<StatusBarItem Grid.Column="0">
					<TextBlock Name="SbConnectionDetails">Disconnected</TextBlock>
				</StatusBarItem>
				<Separator Grid.Column="1" BorderThickness="1" BorderBrush="#ffb6babf"/>
				<StatusBarItem Grid.Column="2">
					<TextBlock Name="SbServerVersion"></TextBlock>
				</StatusBarItem>
				<Separator Grid.Column="3" BorderThickness="1" BorderBrush="#ffb6babf"/>
				<StatusBarItem Grid.Column="4">
					<TextBlock Name="SbEntityName"></TextBlock>
				</StatusBarItem>
			</StatusBar>
		</Border>
	</Grid>
</Window>